package com.demo.spring.service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

/**
 * @author wl
 * @since 2018/4/16
 */
@Service
public class HelloService {

  @Resource
  private Environment env;

  @Value("${test.prop}")
  private String value;

  @PostConstruct
  public void init() {
    System.out.println(getClass().getName() + "  init !");
  }

  public void hello() {
    System.out.println("service @value ---- " + value);
    System.out.println("service env ---- " + env.getProperty("test.prop"));
  }
}